package ventanasYDialogos;

public class DConquista extends javax.swing.JDialog {

    private VPrincipal p;

    public DConquista(java.awt.Frame parent, boolean modal, int tropasQuedaron, int tropasPasar) {
        super(parent, modal);
        initComponents();

        p = (VPrincipal) parent;

        if (tropasQuedaron == 1) {
            this.jRB_3.setEnabled(false);
            this.jRB_2.setEnabled(false);
        } else if (tropasQuedaron == 2) {
            this.jRB_3.setEnabled(false);
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jL_texto = new javax.swing.JLabel();
        jRB_1 = new javax.swing.JRadioButton();
        jRB_2 = new javax.swing.JRadioButton();
        jRB_3 = new javax.swing.JRadioButton();
        jB_aceptar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("TEG CT");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);

        jL_texto.setText("¿Cuántas tropas deseas pasar?");

        buttonGroup1.add(jRB_1);
        jRB_1.setSelected(true);
        jRB_1.setText("1");

        buttonGroup1.add(jRB_2);
        jRB_2.setText("2");

        buttonGroup1.add(jRB_3);
        jRB_3.setText("3");

        jB_aceptar.setText("Aceptar");
        jB_aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_aceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jL_texto, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jRB_1)
                        .addGap(18, 18, 18)
                        .addComponent(jRB_2)
                        .addGap(18, 18, 18)
                        .addComponent(jRB_3)
                        .addGap(15, 15, 15))
                    .addComponent(jB_aceptar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jL_texto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRB_2)
                    .addComponent(jRB_1)
                    .addComponent(jRB_3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jB_aceptar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jB_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_aceptarActionPerformed
    int c = 1;
    if (this.jRB_3.isSelected()) {
        c = 3;
    } else if (this.jRB_2.isSelected()) {
        c = 2;
    }
    p.setCantidadPasar(c);
    this.dispose();
}//GEN-LAST:event_jB_aceptarActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jB_aceptar;
    private javax.swing.JLabel jL_texto;
    private javax.swing.JRadioButton jRB_1;
    private javax.swing.JRadioButton jRB_2;
    private javax.swing.JRadioButton jRB_3;
    // End of variables declaration//GEN-END:variables
}